'use strict'
  class CpcService {
    constructor(rpc_client) {
      this.rpc_client = rpc_client
    }
    /**
    * 查询余额
    * @params shopId 店铺ID
    * @return
    */
    getAllBalance(shopId) {
      return this.rpc_client.request("eleme.cpc.getAllBalance", {
        shopId: shopId,
      })
    }
    /**
    * 确认店铺两证是否齐全
    * @params shopId 店铺ID
    * @return
    */
    checkShopCertification(shopId) {
      return this.rpc_client.request("eleme.cpc.checkShopCertification", {
        shopId: shopId,
      })
    }
    /**
    * 查询推广信息
    * @params shopId 店铺ID
    * @return
    */
    getWagerInformation(shopId) {
      return this.rpc_client.request("eleme.cpc.getWagerInformation", {
        shopId: shopId,
      })
    }
    /**
    * 根据出价查询预估信息
    * @params shopId 店铺ID
    * @params bid CPC出价
    * @return
    */
    getWagerEstimate(shopId, bid) {
      return this.rpc_client.request("eleme.cpc.getWagerEstimate", {
        shopId: shopId,
        bid: bid,
      })
    }
    /**
    * 查询推荐价格、预估信息
    * @params shopId 店铺ID
    * @return
    */
    getSuggestWagerInfo(shopId) {
      return this.rpc_client.request("eleme.cpc.getSuggestWagerInfo", {
        shopId: shopId,
      })
    }
    /**
    * 查询推广修改剩余次数
    * @params shopId 店铺ID
    * @return
    */
    getResidueDegree(shopId) {
      return this.rpc_client.request("eleme.cpc.getResidueDegree", {
        shopId: shopId,
      })
    }
    /**
    * 设置推广状态
    * @params shopId 店铺ID
    * @params status 推广状态
    * @return
    */
    updateWagerStatus(shopId, status) {
      return this.rpc_client.request("eleme.cpc.updateWagerStatus", {
        shopId: shopId,
        status: status,
      })
    }
    /**
    * 设置推广出价
    * @params shopId 店铺ID
    * @params bid 要设置的出价(元)
    * @return
    */
    setWagerGrade(shopId, bid) {
      return this.rpc_client.request("eleme.cpc.setWagerGrade", {
        shopId: shopId,
        bid: bid,
      })
    }
    /**
    * 设置预算
    * @params shopId 店铺ID
    * @params budget 要设置的预算(元)
    * @return
    */
    setWagerBudget(shopId, budget) {
      return this.rpc_client.request("eleme.cpc.setWagerBudget", {
        shopId: shopId,
        budget: budget,
      })
    }
    /**
    * 更新自动投放状态
    * @params shopId 店铺ID
    * @params autoStatus 操作状态
    * @params launchHours 小时集合
    * @return
    */
    updateAutoStatus(shopId, autoStatus, launchHours) {
      return this.rpc_client.request("eleme.cpc.updateAutoStatus", {
        shopId: shopId,
        autoStatus: autoStatus,
        launchHours: launchHours,
      })
    }
    /**
    * 设置推广速率
    * @params shopId 店铺ID
    * @params wagerSpeedMode 速率类型
    * @return
    */
    setWagerSpeed(shopId, wagerSpeedMode) {
      return this.rpc_client.request("eleme.cpc.setWagerSpeed", {
        shopId: shopId,
        wagerSpeedMode: wagerSpeedMode,
      })
    }
    /**
    * 获取竞价推广实时排名
    * @params shopId 店铺ID
    * @return
    */
    getActualRanking(shopId) {
      return this.rpc_client.request("eleme.cpc.getActualRanking", {
        shopId: shopId,
      })
    }
    /**
    * 查询推广效果数据
    * @params shopId 店铺ID
    * @params beginDate 开始时间
    * @params endDate 结束时间
    * @return
    */
    getUVSummary(shopId, beginDate, endDate) {
      return this.rpc_client.request("eleme.cpc.getUVSummary", {
        shopId: shopId,
        beginDate: beginDate,
        endDate: endDate,
      })
    }
    /**
    * 查询推广点击分布信息
    * @params shopId 店铺ID
    * @params beginDate 开始时间
    * @params endDate 结束时间
    * @return
    */
    getRankAndCostInfo(shopId, beginDate, endDate) {
      return this.rpc_client.request("eleme.cpc.getRankAndCostInfo", {
        shopId: shopId,
        beginDate: beginDate,
        endDate: endDate,
      })
    }
    /**
    * 获取推广活跃顾客的点击结构
    * @params shopId 店铺ID
    * @params date 时间
    * @return
    */
    getUserDistribution(shopId, date) {
      return this.rpc_client.request("eleme.cpc.getUserDistribution", {
        shopId: shopId,
        date: date,
      })
    }
}

module.exports = CpcService